﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Os.Domain.Equipamento>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	.: Cadastro de Equipamentos :.
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     <script type="text/javascript">
         $(function() {
             $("#Data").datepicker({
                 changeMonth: true,
                 changeYear: true
             });
             $('#formEquipamento').validate({
                rules: {
                    Descricao: {
                        required: true,
                        minlength: 3
                    }
                },
                messages: {
                    Descricao: {
                        required: " Descrição é Obrigatório",
                        minlength: " Digite no minimo 3 letras"
                    }
                }
             });
         });
    </script>

    <h2>Novo</h2>

    <% using (Html.BeginForm("Novo", "Equipamento", FormMethod.Post, new { id = "formEquipamento" }))
       {%>
        <div class="field-validation-error" ><%= Html.Encode(ViewData["Result"])%></div>

        <fieldset>
            <legend>Preencha os campos abaixo:</legend>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Data)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBox("Data", string.Format("{0:dd/MM/yyy}", Model.Data))%>
                <%= Html.ValidationMessageFor(model => model.Data)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Descricao)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.Descricao)%>
                <%= Html.ValidationMessageFor(model => model.Descricao)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Marca)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.Marca)%>
                <%= Html.ValidationMessageFor(model => model.Marca)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Modelo)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.Modelo)%>
                <%= Html.ValidationMessageFor(model => model.Modelo)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.So)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.So)%>
                <%= Html.ValidationMessageFor(model => model.So)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Localizacao)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.Localizacao)%>
                <%= Html.ValidationMessageFor(model => model.Localizacao)%>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.Observacao)%>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.Observacao)%>
                <%= Html.ValidationMessageFor(model => model.Observacao)%>
            </div>
            
            <div class="editor-label">
                <%= Html.Label("Cliente")%>
            </div>
            <div class="editor-field">
                <%= Html.DropDownList("Cliente", new SelectList(ViewData["Clientes"] as IEnumerable, "IdCliente", "Nome"))%>
            </div>
            
            <p>
                <input type="submit" value="Salvar" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%= Html.ActionLink("Voltar para Lista", "Index") %>
    </div>

</asp:Content>

